﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Silverlight.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using GiveAQuiz.Common;
using GiveAQuiz.Questions;

namespace GiveAQuiz.ClientTests
{
  [TestClass]
  public class MultipleChoiceQuestionTests
  {
    MultipleChoiceQuestionType _question = null;

    [TestInitialize]
    public void Init()
    {
      _question = new MultipleChoiceQuestionType();
      _question.Choices.Clear();
      _question.Choices.Add(new MultipleChoiceQuestionItem() { ChoiceText = "True.", IsCorrectChoice = true });
      _question.Choices.Add(new MultipleChoiceQuestionItem() { ChoiceText = "False.", IsCorrectChoice = false });
    }

    [TestCleanup]
    public void Dispose()
    {
      _question = null;
    }

    [TestMethod]
    public void TestMultipleChoiceCorrect()
    {
      _question.Answers[0].IsCorrectChoice = true;
      _question.Answers[1].IsCorrectChoice = false;
      Assert.IsTrue(_question.GetResult(_question.GetAnswerData()) == QuestionResult.Correct, "Correct Question incorrectly set."); ;
    }

    [TestMethod]
    public void TestMultipleChoiceIncorrect()
    {
      _question.Answers[0].IsCorrectChoice = false;
      _question.Answers[1].IsCorrectChoice = true;
      Assert.IsTrue(_question.GetResult(_question.GetAnswerData()) == QuestionResult.Incorrect, "Incorrect Question incorrectly set."); ;
    }
  }
}